/*
 * display.h
 *
 *  Created on: Dec 9, 2011
 *      Author: Jonathan Marokhovsky
 */


#ifndef DISPLAY_H_
#define DISPLAY_H_

#include <curses.h>
#include <string.h>
#include <signal.h>

/* Server information */
#define SERV_IP		"239.141.188.1"
#define SERV_PORT	23000

/* This is how long the program will wait for input before shutting down automatically */
#define IDLE_TIME	5 // in seconds

char *theMessage;

WINDOW *theWindow;

/*
 * This connects to the server at SERV_IP at port SERV_PORT
 *
 * This is a UDP connection so it's not really a "connection" per se...
 */
int connectToServer();

/*
 * This makes a new window with no cursor etc.
 */
WINDOW *newWin(void);

/*
 * This receives the map from the server
 */
int recvMap(char **newScrnPt[]);

/*
 * This displays the given string
 */
int displayWin(WINDOW* win, char newScreen[]);

/*
 * This makes it so curses closes correctly
 */
void cleanUp(int signal);

/*
 * This gets input from the user
 */
int getCmds(WINDOW *win);

/*
 * This interprets if the user has selected a move.  This returns 0 if it is a move key, otherwise
 *  it returns 1.  This will work with caps lock on as well.
 *
 * Right now the move keys are W, A, S, and D
 */
int interpretMove(char cmd);

/*
 * This interprets if the user has selected a shot
 */
int interpretShot(char cmd);

/*
 * This sends input elsewhere
 */
char *sendCmd(char cmd);

/*
 * This receives a command elsewhere
 */
char *recvCmd(char *message);
#endif /* DISPLAY_H_ */
